package designPattern.template;

public abstract class Diet {

	protected abstract Boolean needBreakfast();

	protected abstract String breakfast();

	protected abstract String lunch();

	protected abstract String dinner();

	protected void onesDiet() {
		System.out.println("大家好，我来讲讲我的饮食情况，");
		if (needBreakfast()) { //还可以使用钩子函数控制模板的执行
			System.out.println("我早饭吃的是" + breakfast());
		}
		System.out.println("我中饭吃的是" + lunch());
		System.out.println("我晚饭吃的是" + dinner());
		System.out.println("嗯，就这些！");
	}
}
